home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Program Name: Stiletto */
- /* */
- /* File Name: CAHandlers.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-07-04 Chris Halim Original version */
- /* 1995-06-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "TextUtils.h"
- #include "Types.h"
-
- #include "Telephones.h"
-
- #include "CAHandlers.h"
- #include "Constants.h"
- #include "DNWindow.h"
- #include "LogWindow.h"
- #include "Utilities.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- /****************************************** PROTOTYPES ******************************************/
-
- void HandleCAAlertingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAOfferMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAProgressMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAOutgoingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCADisconMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAActiveMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAConfMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCATransfMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAHeldMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCADigitsMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAParkedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCACallBackMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCARejectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCADeflectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAForwardedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAConfSplitMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAConfDropMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAQueuedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAInUseMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAPickUpMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAPagingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAInterComMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAModemToneMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAFaxToneMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAIdleMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCASuccessiveAlertMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAOtherMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAUserUserInfoMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
-
- void HandleCAHandOffMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAVoiceDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCASilenceDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCAEnergyDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
- void HandleCADigitsImmMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo);
-
- /******************************************** GLOBALS *******************************************/
-
- extern LogWindowPtr gLogWindow;
- extern TELCAHandle gAvailableCA;
-
- extern TelephoneCAMsgUPP gCAMsgHandlerUPP;
- extern TelephoneCAMsgUPP gCAConfMsgHandlerUPP;
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- #pragma segment CAHandlers
- OSErr InstallCAHandler (TELDNHandle dnHand)
- {
- OSErr errCode;
-
- errCode = TELCAMsgHand (dnHand, telCAOtherMsg | telAllCAMsgs, gCAMsgHandlerUPP, SetCurrentA5());
-
- if (errCode != noErr)
- PutCLine (gLogWindow, kErrorColor, "### TELCAMsgHand fails : %d", errCode);
-
- return (errCode);
- }
-
-
- pascal void AllCAMsgsHandler (TELCAHandle caHand, long msg, short mtype, short value, Ptr msgInfo, long ourA5)
- {
- #pragma unused (mtype, value, msgInfo)
-
- long oldA5;
- char *msgString;
-
- oldA5 = SetA5 (ourA5);
-
- switch (msg) {
- case telCAAlertingMsg : msgString = "telCAAlertingMsg"; break;
- case telCAOfferMsg : msgString = "telCAOfferMsg"; break;
- case telCAProgressMsg : msgString = "telCAProgressMsg"; break;
- case telCAOutgoingMsg : msgString = "telCAOutgoingMsg"; break;
- case telCADisconnectMsg : msgString = "telCADisconnectMsg"; break;
- case telCAActiveMsg : msgString = "telCAActiveMsg"; break;
- case telCAConferenceMsg : msgString = "telCAConferenceMsg"; break;
- case telCATransferMsg : msgString = "telCATransferMsg"; break;
- case telCAHoldMsg : msgString = "telCAHoldMsg"; break;
- case telCADigitsMsg : msgString = "telCADigitsMsg"; break;
- case telCACallParkMsg : msgString = "telCACallParkMsg"; break;
- case telCACallbackMsg : msgString = "telCACallbackMsg"; break;
- case telCARejectMsg : msgString = "telCARejectMsg"; break;
- case telCADeflectMsg : msgString = "telCADeflectMsg"; break;
- case telCAForwardMsg : msgString = "telCAForwardMsg"; break;
- case telCAConferenceSplitMsg : msgString = "telCAConferenceSplitMsg"; break;
- case telCAConferenceDropMsg : msgString = "telCAConferenceDropMsg"; break;
- case telCAQueuedMsg : msgString = "telCAQueuedMsg"; break;
- case telCAInUseMsg : msgString = "telCAInUseMsg"; break;
- case telCACallPickupMsg : msgString = "telCACallPickupMsg"; break;
- case telCAPagingMsg : msgString = "telCAPagingMsg"; break;
- case telCAIntercomMsg : msgString = "telCAIntercomMsg"; break;
- case telCAModemToneMsg : msgString = "telCAModemToneMsg"; break;
- case telCAFaxToneMsg : msgString = "telCAFaxToneMsg"; break;
- case telCAIdleMsg : msgString = "telCAIdleMsg"; break;
- case telCASuccessiveAlertMsg : msgString = "telCASuccessiveAlertMsg"; break;
- case telCAUserUserInfoMsg : msgString = "telCAUserUserInfoMsg"; break;
-
- case telCAHandOffMsg : msgString = "telCAHandOffMsg"; break;
- case telCAVoiceDetectedMsg : msgString = "telCAVoiceDetectedMsg"; break;
- case telCASilenceDetectedMsg : msgString = "telCASilenceDetectedMsg"; break;
- // case telCAEnergyDetectedMsg : msgString = "telCAEnergyDetectedMsg"; break;
- case telCADigitsImmMsg : msgString = "telCADigitsImmMsg"; break;
-
- case telCAOtherMsg : msgString = "telCAOtherMsg"; break;
-
- default :
- PutCLine (gLogWindow, kErrorColor, "### Unknown caMsg : %08x", msg);
- msgString = "### Unknown";
- }
- PutLine (gLogWindow, ">>> got a CA message (%08x) : %s", caHand, msgString);
-
- (void) SetA5 (oldA5);
- }
-
-
- pascal void CAActiveMsgHandler (TELCAHandle caHand, long msg, short mtype, short value, Ptr msgInfo, long ourA5)
- {
- #pragma unused (mtype, value, msgInfo)
-
- long oldA5;
-
- oldA5 = SetA5 (ourA5);
-
- if (msg == telCAActiveMsg)
- PutLine (gLogWindow, "=== telCAActiveMsg (%08x)", caHand);
- else
- PutCLine (gLogWindow, kErrorColor, "### Expect a telCAActiveMsg but got : %d", msg);
-
- (void) SetA5 (oldA5);
- }
-
-
- pascal void CAConfMsgHandler (TELCAHandle caHand, long msg, short mtype, short value, Ptr msgInfo, long ourA5)
- {
- #pragma unused (msg, mtype, value, msgInfo)
-
- long oldA5;
- CAWindowPtr caWindow;
- OSErr errCode;
-
- oldA5 = SetA5 (ourA5);
-
- if (msg == telCAActiveMsg) {
- if (caHand != nil) {
- caWindow = (CAWindowPtr) (*caHand)->userData;
- if (caWindow->fConfInitiated) {
- HiliteControl (caWindow->fConf, 0); // enable it
-
- if ((errCode = TELClrCAMsgHand ((*caHand)->hTELDN, gCAConfMsgHandlerUPP) != noErr))
-
- PutCLine (gLogWindow, kErrorColor, "### TELClrCAMsgHand fails : %d", errCode);
- }
- }
- } else
- PutCLine (gLogWindow, kErrorColor, "### Expect a telCAActiveMsg but got : %08x", msg);
-
- (void) SetA5 (oldA5);
- }
-
-
- pascal void CAMsgHandler (TELCAHandle caHand, long msg, short mtype, short value, Ptr msgInfo, long ourA5)
- {
- long oldA5;
-
- oldA5 = SetA5 (ourA5);
-
- switch (msg) {
- case telCAAlertingMsg :
- HandleCAAlertingMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAOfferMsg :
- HandleCAOfferMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAProgressMsg :
- HandleCAProgressMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAOutgoingMsg :
- HandleCAOutgoingMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCADisconnectMsg :
- HandleCADisconMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAActiveMsg :
- HandleCAActiveMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAConferenceMsg :
- HandleCAConfMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCATransferMsg :
- HandleCATransfMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAHoldMsg :
- HandleCAHeldMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCADigitsMsg :
- HandleCADigitsMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCACallParkMsg :
- HandleCAParkedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCACallbackMsg :
- HandleCACallBackMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCARejectMsg :
- HandleCARejectedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCADeflectMsg :
- HandleCADeflectedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAForwardMsg :
- HandleCAForwardedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAConferenceSplitMsg :
- HandleCAConfSplitMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAConferenceDropMsg :
- HandleCAConfDropMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAQueuedMsg :
- HandleCAQueuedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAInUseMsg :
- HandleCAInUseMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCACallPickupMsg :
- HandleCAPickUpMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAPagingMsg :
- HandleCAPagingMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAIntercomMsg :
- HandleCAInterComMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAModemToneMsg :
- HandleCAModemToneMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAFaxToneMsg :
- HandleCAFaxToneMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAIdleMsg :
- HandleCAIdleMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCASuccessiveAlertMsg :
- HandleCASuccessiveAlertMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAUserUserInfoMsg :
- HandleCAUserUserInfoMsg (caHand, mtype, value, msgInfo);
- break;
-
-
- case telCAHandOffMsg :
- HandleCAHandOffMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCAVoiceDetectedMsg :
- HandleCAVoiceDetectedMsg (caHand, mtype, value, msgInfo);
- break;
-
- case telCASilenceDetectedMsg :
- HandleCASilenceDetectedMsg (caHand, mtype, value, msgInfo);
- break;
-
- // case telCAEnergyDetectedMsg :
- // HandleCAEnergyDetectedMsg (caHand, mtype, value, msgInfo);
- // break;
-
- case telCADigitsImmMsg :
- HandleCADigitsImmMsg (caHand, mtype, value, msgInfo);
- break;
-
-
- case telCAOtherMsg :
- HandleCAOtherMsg (caHand, mtype, value, msgInfo);
- break;
-
- default :
- PutCLine (gLogWindow, kErrorColor, "### Unknown caMsg : %08x", msg);
- }
-
- if (caHand != nil)
- if (msg != telCAIdleMsg)
- UpdateCAListState (GetDNWindow (caHand), caHand);
-
- (void) SetA5 (oldA5);
- }
-
-
- void HandleCAAlertingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- DNWindowPtr dnWindow;
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAAlertingMsg (%08x) --> pattern# = %d", caHand, value);
-
- if (caHand != nil)
- {
- dnWindow = GetDNWindow (caHand);
- if (dnWindow != nil)
- AppendCAList (dnWindow, caHand);
- else
- PutCLine (gLogWindow, kErrorColor, "### Can't find the corresponding dnWindow");
- }
- }
-
-
- void HandleCAOfferMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAOfferMsg (%08x)", caHand);
- }
-
-
- void HandleCAProgressMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telCAPDialTone :
- valueStr = "telCAPDialTone";
- break;
- case telCAPRinging :
- valueStr = "telCAPRinging";
- break;
- case telCAPDialing :
- valueStr = "telCAPDialing";
- break;
- case telCAPReorder :
- valueStr = "telCAPReorder";
- break;
- case telCAPBusy :
- valueStr = "telCAPBusy";
- break;
- case telCAPRouted :
- valueStr = "telCAPRouted";
- break;
- case telCAPRoutedOff :
- valueStr = "telCAPRoutedOff";
- break;
- case telCAPTimeout :
- valueStr = "telCAPTimeout";
- break;
- case telCAPUpdate :
- valueStr = "telCAPUpdate";
- break;
- case telCAPPrompt :
- valueStr = "telCAPPrompt";
- break;
- case telCAPWaiting :
- valueStr = "telCAPWaiting";
- break;
- case telCAPCPC :
- valueStr = "telCAPCPC";
- break;
- case telCAPNoDialTone :
- valueStr = "telCAPNoDialTone";
- break;
- case telCAPUnknown :
- valueStr = "telCAPUnknown";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAProgressMsg (%08x) --> %s", caHand, valueStr);
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCAOutgoingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
-
- DNWindowPtr dnWindow;
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAOutgoingMsg (%08x) --> %s", caHand, (value)?"programmatic":"physical");
-
- if (caHand != nil)
- if (((*caHand)->userData) == nil) { // (userData == nil) means there is no caWindow associated
- // with this CA, so create its caWindow.
- gAvailableCA = caHand;
-
- dnWindow = GetDNWindow (caHand);
- if (dnWindow != nil)
- AppendCAList (dnWindow, caHand);
- else
- PutCLine (gLogWindow, kErrorColor, "### Can't find the corresponding dnWindow");
- }
- }
-
-
- void HandleCADisconMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
-
- char * valueStr;
-
- switch (value) {
- case telCADNormal :
- valueStr = "telCADNormal";
- break;
- case telCADBusy :
- valueStr = "telCADBusy";
- break;
- case telCADNoResponse :
- valueStr = "telCADNoResponse";
- break;
- case telCADRejected :
- valueStr = "telCADRejected";
- break;
- case telCADNumberChanged :
- valueStr = "telCADNumberChanged";
- break;
- case telCADInvalidDest :
- valueStr = "telCADInvalidDest";
- break;
- case telCADFacilityRejected :
- valueStr = "telCADFacilityRejected";
- break;
- case telCADUnobtainableDest :
- valueStr = "telCADUnobtainableDest";
- break;
- case telCADCongested :
- valueStr = "telCADCongested";
- break;
- case telCADIncompatibleDest :
- valueStr = "telCADIncompatibleDest";
- break;
- case telCADTimeout :
- valueStr = "telCADTimeout";
- break;
- case telCADUnknown :
- valueStr = "telCADUnknown";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCADisconnectMsg (%08x) --> %s (by %s user)", caHand, valueStr, (mtype)?"remote":"local");
- }
-
-
- void HandleCAActiveMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
- CAWindowPtr caWindow;
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAActiveMsg (%08x)", caHand);
-
- if (caHand != nil) {
- caWindow = (CAWindowPtr) (*caHand)->userData;
- SetCtlValue (caWindow->fHold, false);
- }
- }
-
-
- void HandleCAConfMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
-
- switch (value) {
- case telConferencePrepFailed :
- valueStr = "telConferencePrepFailed";
- break;
- case telConferencePending :
- valueStr = "telConferencePending";
- break;
- case telConferenceEstFailed :
- valueStr = "telConferenceEstFailed";
- break;
- case telConferenceEst :
- valueStr = "telConferenceEst";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAConferenceMsg (%08x) --> %s", caHand, valueStr);
- PutLine (gLogWindow, " relatedCA = %08x", ((CAConfMsgRec*) msgInfo)->relatedCA);
- }
-
-
- void HandleCATransfMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telTransferPrepFailed :
- valueStr = "telTransferPrepFailed";
- break;
- case telTransferPending :
- valueStr = "telTransferPending";
- break;
- case telTransferEst :
- valueStr = "telTransferEst";
- break;
- case telTransferFailed :
- valueStr = "telTransferFailed";
- break;
- case telTransferred :
- valueStr = "telTransferred";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCATransferMsg (%08x) --> %s", caHand, valueStr);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CATransfMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " rmtName = %s", ConvertToCString ((char *) tString, (char *) ((CATransfMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CATransfMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CATransfMsgRec*) msgInfo)->dialType);
- PutLine (gLogWindow, " prepCA = %08x", ((CATransfMsgRec*) msgInfo)->prepCA);
- }
-
-
- void HandleCAHeldMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- char *valueStr;
- CAWindowPtr caWindow;
-
- switch (value) {
- case telHoldCleared :
- valueStr = "telHoldCleared";
- break;
- case telHoldEst :
- valueStr = "telHoldEst";
- break;
- case telHoldFailed :
- valueStr = "telHoldFailed";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAHoldMsg (%08x) --> %s", caHand, valueStr);
-
- if ((caHand != nil) && ((value == telHoldCleared) || (value == telHoldEst))) {
- caWindow = (CAWindowPtr) (*caHand)->userData;
- SetCtlValue (caWindow->fHold, (value == telHoldEst));
- }
- }
-
-
- void HandleCADigitsMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCADigitsMsg (%08x) --> %c (%s)", caHand, value, (mtype)?"telDigitNotAudible":"telDigitAudible");
- }
-
-
- void HandleCAParkedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telCallParkEst :
- valueStr = "telCallParkEst";
- break;
- case telCallParkRetrieveEst :
- valueStr = "telCallParkRetrieveEst";
- break;
- case telCallParkFailed :
- valueStr = "telCallParkFailed";
- break;
- case telCallParkRetrieveFailed :
- valueStr = "telCallParkRetrieveFailed";
- break;
- case telCallParkRecall :
- valueStr = "telCallParkRecall";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCACallParkMsg (%08x) --> %s", caHand, valueStr);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCACallBackMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telCallbackCleared :
- valueStr = "telCallbackCleared";
- break;
- case telCallbackEst :
- valueStr = "telCallbackEst";
- break;
- case telCallbackNowAvail :
- valueStr = "telCallbackNowAvail";
- break;
- case telCallbackFailed :
- valueStr = "telCallbackFailed";
- break;
- case telCallbackDesired :
- valueStr = "telCallbackDesired";
- break;
- case telCallbackDesiredCleared :
- valueStr = "telCallbackDesiredCleared";
- break;
- case telCalledback :
- valueStr = "telCalledback";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCACallbackMsg (%08x) --> %s, cbRef = %d", caHand, valueStr, mtype);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCARejectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- char * valueStr;
-
- switch (value) {
- case telCallRejectFailed :
- valueStr = "telCallRejectFailed";
- break;
- case telCallRejectEst :
- valueStr = "telCallRejectEst";
- break;
- case telCallRejected :
- valueStr = "telCallRejected";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCARejectMsg (%08x) --> %s", caHand, valueStr);
- }
-
-
- void HandleCADeflectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telCallDeflectFailed :
- valueStr = "telCallDeflectFailed";
- break;
- case telCallDeflectEst :
- valueStr = "telCallDeflectEst";
- break;
- case telCallDeflectRecall :
- valueStr = "telCallDeflectRecall";
- break;
- case telCallDeflected :
- valueStr = "telCallDeflected";
- break;
- case telAutoDeflectNoAnswer :
- valueStr = "telAutoDeflectNoAnswer";
- break;
- case telAutoDeflectBusy :
- valueStr = "telAutoDeflectBusy";
- break;
- case telAutoDeflectImmediate :
- valueStr = "telAutoDeflectImmediate";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCADeflectMsg (%08x) --> %s", caHand, valueStr);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCAForwardedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telForwardImmediate :
- valueStr = "telForwardImmediate";
- break;
- case telForwardBusy :
- valueStr = "telForwardBusy";
- break;
- case telForwardNoAnswer :
- valueStr = "telForwardNoAnswer";
- break;
- case telForwardBusyNA :
- valueStr = "telForwardBusyNA";
- break;
- case telForwardTypeUnknown :
- valueStr = "telForwardTypeUnknown";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAForwardMsg (%08x) --> %s", caHand, valueStr);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCAConfSplitMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
-
- switch (value) {
- case telConferenceSplitFailed :
- valueStr = "telConferenceSplitFailed";
- break;
- case telConferenceSplitEst :
- valueStr = "telConferenceSplitEst";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAConferenceSplitMsg (%08x) --> %s", caHand, valueStr);
- PutLine (gLogWindow, " relatedCA = %08x", ((CAConfMsgRec*) msgInfo)->relatedCA);
- }
-
-
- void HandleCAConfDropMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
-
- switch (value) {
- case telConferenceDropFailed :
- valueStr = "telConferenceDropFailed";
- break;
- case telConferenceDropped :
- valueStr = "telConferenceDropped";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAConferenceDropMsg (%08x) --> %s", caHand, valueStr);
- PutLine (gLogWindow, " relatedCA = %08x", ((CAConfMsgRec*) msgInfo)->relatedCA);
- }
-
-
- void HandleCAQueuedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAQueuedMsg (%08x)", caHand);
- }
-
-
- void HandleCAInUseMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAInUseMsg (%08x)", caHand);
- }
-
-
- void HandleCAPickUpMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype)
- char * valueStr;
- Str255 tString;
-
- switch (value) {
- case telCallPickupEst :
- valueStr = "telCallPickupEst";
- break;
- case telCallPickupFailed :
- valueStr = "telCallPickupFailed";
- break;
- case telCallPickedUp :
- valueStr = "telCallPickedUp";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCACallPickupMsg (%08x) --> %s", caHand, valueStr);
-
- PutLine (gLogWindow, " rmtDN = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtDN));
- PutLine (gLogWindow, " name = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtName));
- PutLine (gLogWindow, " rmtSubaddress = %s", ConvertToCString ((char *) tString, (char *) ((CAGenericMsgRec*) msgInfo)->rmtSubaddress));
-
- PutLine (gLogWindow, " dialType = %d", ((CAGenericMsgRec*) msgInfo)->dialType);
- }
-
-
- void HandleCAPagingMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
- char * valueStr;
-
- switch (value) {
- case telPageEst :
- valueStr = "telPageEst";
- break;
- case telPageComplete :
- valueStr = "telPageComplete";
- break;
- case telPageFailed :
- valueStr = "telPageFailed";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: caPageMsg (%08x) --> %s, pageID = %d", caHand, valueStr, mtype);
- }
-
-
- void HandleCAInterComMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- char * valueStr;
-
- switch (value) {
- case telIntercomEst :
- valueStr = "telIntercomEst";
- break;
- case telIntercomComplete :
- valueStr = "telIntercomComplete";
- break;
- case telIntercomFailed :
- valueStr = "telIntercomFailed";
- break;
- default :
- valueStr = "### Unknown value";
- PutCLine (gLogWindow, kErrorColor, "### Unknown value : %d", value);
- }
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAIntercomMsg (%08x) --> %s", caHand, valueStr);
- }
-
-
- void HandleCAModemToneMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAModemToneMsg (%08x) --> %s", caHand, (value)?"telModemToneCleared":"telModemToneDetected");
- }
-
-
- void HandleCAFaxToneMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAFaxToneMsg (%08x) --> %s", caHand, (value)?"telFaxToneCleared":"telFaxToneDetected");
- }
-
-
- void HandleCAIdleMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
-
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAIdleMsg (%08x)", caHand);
-
- if (caHand != nil) {
- if (gAvailableCA == caHand)
- gAvailableCA = nil;
- RemoveFromCAList ((DNWindowPtr) (*caHand)->refCon, caHand);
- }
- }
-
-
- void HandleCASuccessiveAlertMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCASuccessiveAlertMsg (%08x) --> numOfRings = %d", caHand, value);
- }
-
-
- void HandleCAUserUserInfoMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAUserUserInfoMsg (%08x) --> %s", caHand, ((CAUserUserInfoMsgRec*) msgInfo)->userUserInfo);
- }
-
-
-
- void HandleCAHandOffMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAHandOffMsg (%08x) --> Answered on TollSaverRingCount = %s", caHand, (mtype)?"Yes":"No");
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAHandOffMsg (%08x) --> Voice energy detected = %s", caHand, (value)?"Energy":"NonEnergy");
- }
-
- void HandleCAVoiceDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, value, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAVoiceDetectedMsg (%08x)", caHand);
- }
-
- void HandleCASilenceDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (mtype, msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCASilenceDetectedMsg (%08x) --> Silence period = %d", caHand, value);
- }
-
- //void HandleCAEnergyDetectedMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- //{
- // char * timeStampStr = nil;
- //
- // PutCLine (gLogWindow, kCAMsgColor, "::: telCAEnergyDetectedMsg (%08x) --> Energy type = %s", caHand, (mtype)?"VoiceEnergy":"MiscEnergy");
- // PutCLine (gLogWindow, kCAMsgColor, "::: telCAEnergyDetectedMsg (%08x) --> Energy detected = %s", caHand, (value)?"Energy":"NonEnergy");
- //
- // PutLine (gLogWindow, " energyPeriod = %lu", ((CAEnergyDetMsgRec*) msgInfo)->energyPeriod);
- // PutLine (gLogWindow, " nonEnergyPeriod = %lu", ((CAEnergyDetMsgRec*) msgInfo)->nonEnergyPeriod);
- // PutLine (gLogWindow, " timeStamp = %lu", ((CAEnergyDetMsgRec*) msgInfo)->timeStamp); /* TEMPORARY */
- //
- // iudatestring (((CAEnergyDetMsgRec*) msgInfo)->timeStamp, shortDate, timeStampStr);
- //
- // PutLine (gLogWindow, " timeStamp = %s", timeStampStr);
- //}
-
-
- void HandleCADigitsImmMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCADigitsImmMsg (%08x) --> %c (%s)", caHand, value, (mtype)?"telDigitNotAudible":"telDigitAudible");
- }
-
-
-
- void HandleCAOtherMsg (TELCAHandle caHand, short mtype, short value, Ptr msgInfo)
- {
- #pragma unused (msgInfo)
- PutCLine (gLogWindow, kCAMsgColor, "::: telCAOtherMsg (%08x) --> (vendor defined) type = %d, value = %d",caHand, mtype, value);
- }
-
-
- void GetCAStateStr (TELCAHandle caHand, char **stateStr)
- {
- OSErr errCode;
- short state;
-
- if (caHand != nil) {
- if ((errCode = TELGetCAState (caHand, &state)) == noErr) {
- switch (state) {
- case telCAIdleState :
- *stateStr = "idle";
- break;
- case telCAInUseState :
- *stateStr = "in use";
- break;
- case telCAOfferState :
- *stateStr = "offer";
- break;
- case telCAQueuedState :
- *stateStr = "queued";
- break;
- case telCAAlertingState :
- *stateStr = "alerting";
- break;
- case telCADialToneState :
- *stateStr = "dial tone";
- break;
- case telCADialingState :
- *stateStr = "dialing";
- break;
- case telCAWaitingState :
- *stateStr = "waiting";
- break;
- case telCARingingState :
- *stateStr = "ringing";
- break;
- case telCABusyState :
- *stateStr = "busy";
- break;
- case telCAHeldState :
- *stateStr = "held";
- break;
- case telCAConferencedState :
- *stateStr = "conferenced";
- break;
- case telCAActiveState :
- *stateStr = "active";
- break;
- case telCAReorderState :
- *stateStr = "reorder";
- break;
- case telCAConferencedHeldState :
- *stateStr = "conference held";
- break;
- case telCAUnknownState :
- *stateStr = "unknown state";
- break;
- default :
- *stateStr = "### undefined state";
- }
- }
- // else
- // PutCLine (gLogWindow, kErrorColor, "### TELGetCAState fails : %d", errCode);
- }
- }
-
-
- #pragma segment Dump
- void DumpCAFlags (TELCAHandle caHand)
- {
- OSErr errCode;
- long caFeatureFlags, caOtherFeatures;
-
- if (caHand != nil) {
- if ((errCode = TELGetCAFlags (caHand, &caFeatureFlags, &caOtherFeatures)) == noErr) {
- PutLine (gLogWindow, "=============== caFeatureFlags ===============");
- PutLine (gLogWindow, " featureFlags : %08x", caFeatureFlags);
- PutLine (gLogWindow, " %c holdSub", (caFeatureFlags & holdSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c holdAvail", (caFeatureFlags & holdAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c holdActive", (caFeatureFlags & holdActive)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceSub", (caFeatureFlags & conferenceSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceAvail", (caFeatureFlags & conferenceAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceActive", (caFeatureFlags & conferenceActive)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceDropSub", (caFeatureFlags & conferenceDropSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceDropAvail", (caFeatureFlags & conferenceDropAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceSplitSub", (caFeatureFlags & conferenceSplitSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c conferenceSplitAvail", (caFeatureFlags & conferenceSplitAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c numToConferenceRequired", (caFeatureFlags & numToConferenceRequired)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c transferSub", (caFeatureFlags & transferSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c transferAvail", (caFeatureFlags & transferAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c transferActive", (caFeatureFlags & transferActive)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c caRelated", (caFeatureFlags & caRelated)?checkChar:spaceChar);
- PutLine (gLogWindow, " remainder : %08x", (caFeatureFlags & (0xFFFFFFFF << 15)));
- PutLine (gLogWindow, "=============== caOtherFeatures ===============");
- PutLine (gLogWindow, " otherFeatures : %08x", caOtherFeatures);
- PutLine (gLogWindow, " %c callbackSub", (caOtherFeatures & callbackSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackAvail", (caOtherFeatures & callbackAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackActive", (caOtherFeatures & callbackActive)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackClearSub", (caOtherFeatures & callbackClearSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackNowSub", (caOtherFeatures & callbackNowSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackNowAvail", (caOtherFeatures & callbackNowAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackBusy", (caOtherFeatures & callbackBusy)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackNoAnswer", (caOtherFeatures & callbackNoAnswer)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callbackReturnsRef", (caOtherFeatures & callbackReturnsRef)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkSub", (caOtherFeatures & parkSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkAvail", (caOtherFeatures & parkAvail)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkActive", (caOtherFeatures & parkActive)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkRetrieveSub", (caOtherFeatures & parkRetrieveSub)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkRetrieveWithID", (caOtherFeatures & parkRetrieveWithID)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkWithReturnedID", (caOtherFeatures & parkWithReturnedID)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c parkWithGivenID", (caOtherFeatures & parkWithGivenID)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c rejectable", (caOtherFeatures & rejectable)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c deflectable", (caOtherFeatures & deflectable)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c acceptable", (caOtherFeatures & acceptable)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c voiceDetected", (caOtherFeatures & voiceDetected)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c callAnswdTSRings", (caOtherFeatures & callAnswdTSRings)?checkChar:spaceChar);
- PutLine (gLogWindow, " remainder : %08x", (caOtherFeatures & (0xFFFFFFFF << 21)));
- } else
- PutCLine (gLogWindow, kErrorColor, "### TELGetCAFlags fails : %d", errCode);
- }
- }
-
-
- #pragma segment Dump
- void DumpCAState (TELCAHandle caHand)
- {
- OSErr errCode;
- short state;
- char *stateStr;
-
- if (caHand != nil) {
- if ((errCode = TELGetCAState (caHand, &state)) == noErr) {
- switch (state) {
- case telCAIdleState :
- stateStr = "idle";
- break;
- case telCAInUseState :
- stateStr = "in use";
- break;
- case telCAOfferState :
- stateStr = "offer";
- break;
- case telCAQueuedState :
- stateStr = "queued";
- break;
- case telCAAlertingState :
- stateStr = "alerting";
- break;
- case telCADialToneState :
- stateStr = "dial tone";
- break;
- case telCADialingState :
- stateStr = "dialing";
- break;
- case telCAWaitingState :
- stateStr = "waiting";
- break;
- case telCARingingState :
- stateStr = "ringing";
- break;
- case telCABusyState :
- stateStr = "busy";
- break;
- case telCAHeldState :
- stateStr = "held";
- break;
- case telCAConferencedState :
- stateStr = "conferenced";
- break;
- case telCAActiveState :
- stateStr = "active";
- break;
- case telCAReorderState :
- stateStr = "reorder";
- break;
- case telCAConferencedHeldState :
- stateStr = "conference held";
- break;
- case telCAUnknownState :
- stateStr = "unknown state";
- break;
- default :
- stateStr = "### undefined state";
- }
- PutLine (gLogWindow, "=============== CA State ===============");
- PutLine (gLogWindow, " current castate (%d) = %s", state, stateStr);
- } else
- PutCLine (gLogWindow, kErrorColor, "### TELGetCAState fails : %d", errCode);
- }
- }
-
-
- #pragma segment Dump
- void DumpCAInfo (TELCAHandle caHand)
- {
- OSErr errCode;
- long flags;
- Str255 tString;
-
- if (caHand != nil) {
- if ((errCode = TELGetCAInfo (caHand)) == noErr) {
- PutLine (gLogWindow, "=============== TELCARecord ===============");
- PutLine (gLogWindow, " caRef : %04x", (**caHand).caRef);
- PutLine (gLogWindow, " hTELDN : %08x", (**caHand).hTELDN);
- PutLine (gLogWindow, " hTEL : %08x", (**caHand).hTEL);
- PutLine (gLogWindow, " caState : %d", (**caHand).caState);
- PutLine (gLogWindow, " relatedCA : %08x", (**caHand).relatedCA);
- PutLine (gLogWindow, " connectTime : %ld", (**caHand).connectTime);
- PutLine (gLogWindow, " intExt : %d", (**caHand).intExt);
- PutLine (gLogWindow, " callType : %d", (**caHand).callType);
- PutLine (gLogWindow, " dialType : %d", (**caHand).dialType);
- PutLine (gLogWindow, " bearerType : %d", (**caHand).bearerType);
- PutLine (gLogWindow, " rate : %d", (**caHand).rate);
- PutLine (gLogWindow, " rmtDN : %s", ConvertToCString ((char *) tString, (char *) (**caHand).rmtDN));
- PutLine (gLogWindow, " rmtPartyName : %s", ConvertToCString ((char *) tString, (char *) (**caHand).rmtPartyName));
- PutLine (gLogWindow, " rmtSubaddress : %s", ConvertToCString ((char *) tString, (char *) (**caHand).rmtSubaddress));
- PutLine (gLogWindow, " routeDN : %s", ConvertToCString ((char *) tString, (char *) (**caHand).routeDN));
- PutLine (gLogWindow, " routePartyName : %s", ConvertToCString ((char *) tString, (char *) (**caHand).routePartyName));
- PutLine (gLogWindow, " routeSubaddress : %s", ConvertToCString ((char *) tString, (char *) (**caHand).routeSubaddress));
- PutLine (gLogWindow, " priority : %d", (**caHand).priority);
- PutLine (gLogWindow, " conferenceLimit : %d", (**caHand).conferenceLimit);
-
- flags = (**caHand).featureFlags;
- PutLine (gLogWindow, " featureFlags : %08x", flags);
-
- flags = (**caHand).otherFeatures;
- PutLine (gLogWindow, " otherFeatures : %08x", flags);
-
- PutLine (gLogWindow, " telCAPrivate : %08x", (**caHand).telCAPrivate);
- PutLine (gLogWindow, " refCon : %08x", (**caHand).refCon);
- PutLine (gLogWindow, " userData : %08x", (**caHand).userData);
-
- PutLine (gLogWindow, " reserved : %08x", (**caHand).reserved);
- } else
- PutCLine (gLogWindow, kErrorColor, "### TELCAGetInfo fails : %d", errCode);
- }
- }
-
-
- #pragma segment Dump
- void DumpCAEvents (TELDNHandle dnHand)
- {
- OSErr errCode;
- long eventMask;
-
- if (dnHand != nil) {
- if ((errCode = TELCAEventsSupp (dnHand, &eventMask)) == noErr) {
- PutLine (gLogWindow, "=============== CAEvents ===============");
- PutLine (gLogWindow, " mask : %08x", eventMask);
- PutLine (gLogWindow, " %c telCAAlertingMsg", (eventMask & telCAAlertingMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAOfferMsg", (eventMask & telCAOfferMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAProgressMsg", (eventMask & telCAProgressMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAOutgoingMsg", (eventMask & telCAOutgoingMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCADisconnectMsg", (eventMask & telCADisconnectMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAActiveMsg", (eventMask & telCAActiveMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAConferenceMsg", (eventMask & telCAConferenceMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCATransferMsg", (eventMask & telCATransferMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAHoldMsg", (eventMask & telCAHoldMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCADigitsMsg", (eventMask & telCADigitsMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCACallParkMsg", (eventMask & telCACallParkMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCACallbackMsg", (eventMask & telCACallbackMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCARejectMsg", (eventMask & telCARejectMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCADeflectMsg", (eventMask & telCADeflectMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAForwardMsg", (eventMask & telCAForwardMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAConferenceSplitMsg", (eventMask & telCAConferenceSplitMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAConferenceDropMsg", (eventMask & telCAConferenceDropMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAQueuedMsg", (eventMask & telCAQueuedMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAInUseMsg", (eventMask & telCAInUseMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCACallPickupMsg", (eventMask & telCACallPickupMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAPagingMsg", (eventMask & telCAPagingMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAIntercomMsg", (eventMask & telCAIntercomMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAModemToneMsg", (eventMask & telCAModemToneMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAFaxToneMsg", (eventMask & telCAFaxToneMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAIdleMsg", (eventMask & telCAIdleMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCASuccessiveAlertMsg", (eventMask & telCASuccessiveAlertMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAUserUserInfoMsg", (eventMask & telCAUserUserInfoMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAOtherMsg", (eventMask & telCAOtherMsg)?checkChar:spaceChar);
-
- PutLine (gLogWindow, " %c telCAHandOffMsg", (eventMask & telCAHandOffMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCAVoiceDetectedMsg", (eventMask & telCAVoiceDetectedMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCASilenceDetectedMsg", (eventMask & telCASilenceDetectedMsg)?checkChar:spaceChar);
- // PutLine (gLogWindow, " %c telCAEnergyDetectedMsg", (eventMask & telCAEnergyDetectedMsg)?checkChar:spaceChar);
- PutLine (gLogWindow, " %c telCADigitsImmMsg", (eventMask & telCADigitsImmMsg)?checkChar:spaceChar);
-
- PutLine (gLogWindow, " remainder : %08x", (eventMask & ~(telAllCAMsgs | telCAOtherMsg)));
- } else
- PutCLine (gLogWindow, kErrorColor, "### TELCAEventsSupp fails : %d", errCode);
- }
- }
-